<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
</head>

<body>
    <div id="app">
        <!-- <h1>enter</h1> -->
        <!-- v-on 监听 enter键盘的抬起事件  去找 submit函数-->
        <input v-model='message' v-on:keyup.enter='submit1111' type="text">
        <button @click='baidu1'>baidu搜索</button>

        <ul>
            <li v-for="(item,index) in fruits">
                {{item}}----{{index}}
            </li>
        </ul>
         

        <!-- <input   v-on:keyup.space='a' type="text">


   
        <input type="text" v-on:keyup.65 ='fn1'> -->
    </div>


    <script>
   
        var app = new Vue({
            el: '#app',
            data: {
                message: '',
                fruits:[]
            },
            methods:{
                submit1111(){
                    console.log('enter键盘 抬起了')
                    console.log(this.message)
                    // ajax请求  动态渲染 
                },
                baidu1(){
                    console.log('baidu1搜索')
                    console.log(this.message)
                    
                    this.fruits =['苹果','香蕉','西瓜','芒果']
                      // ajax请求  动态渲染 
                },
                a(){
                    alert('空格抬起')
                },
                fn1(){
                    alert('a')
                }
            }
        })

        console.log('app', app)

    </script>
</body>

</html>